ifeq ($(TOP_DIR),)

ifneq ($(NOT_SUPPORT_SP), y)
    EXTRA_CFLAGS += -fstack-protector-all
endif

ifeq ($(DAVINCI_HIAI_DKMS),y)
    EXTRA_CFLAGS += -I$(HIAI_DKMS_DIR)/dev_inc
    EXTRA_CFLAGS += -I$(HIAI_DKMS_DIR)/libc_sec/include

    ifeq ($(TARGET_PRODUCT),cloud)
        EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_CLOUD
        EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_CLOUD_HOST
    else
        ifeq ($(TARGET_CHIP_ID),$(ASCEND_FLORENCE_DC_V10))
            EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_ESL_FPGA
            EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_MDC_V51
        else
            EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_MINIV1
        endif
    endif

else
    CUR_MAKEFILE_PATH := $(strip \
                $(eval LOCAL_MODULE_MAKEFILE := $$(lastword $$(MAKEFILE_LIST))) \
                $(patsubst %/,%, $(dir $(LOCAL_MODULE_MAKEFILE))) \
                )

    EXTRA_CFLAGS += -I$(CUR_MAKEFILE_PATH)/../../../../drivers/dev_inc
    EXTRA_CFLAGS += -I$(CUR_MAKEFILE_PATH)/../../../../libc_sec/include
    ifeq ($(TARGET_PRODUCT),cloud)
        EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_CLOUD
        EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_CLOUD_HOST
    else
        ifeq ($(TARGET_CHIP_ID),$(ASCEND_FLORENCE_DC_V10))
            EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_ESL_FPGA
            EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_MDC_V51
        else
            EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_MINIV1
        endif
    endif

endif

ccflags-y += -Wall -Werror

obj-m += drv_pcie_hdc_host.o

drv_pcie_hdc_host-objs := hdcdrv_core.o hdcdrv_core_com.o hdcdrv_host.o hdcdrv_mem.o hdcdrv_mem_com.o hdcdrv_epoll.o hdcdrv_sysfs.o

else

ifneq ($(NOT_SUPPORT_SP), y)
    EXTRA_CFLAGS += -fstack-protector-all
endif

ifeq ($(DAVINCI_HIAI_DKMS),y)
    EXTRA_CFLAGS += -I$(HIAI_DKMS_DIR)/dev_inc
    EXTRA_CFLAGS += -I$(HIAI_DKMS_DIR)/libc_sec/include

    ifeq ($(TARGET_PRODUCT),cloud)
        EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_CLOUD
        EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_CLOUD_HOST
    else
        ifeq ($(TARGET_CHIP_ID),$(ASCEND_FLORENCE_DC_V10))
            EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_ESL_FPGA
            EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_MDC_V51
        else
            EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_MINIV1
        endif
    endif

else

    EXTRA_CFLAGS += -I$(TOP_DIR)/drivers/dev_inc
    EXTRA_CFLAGS += -I$(TOP_DIR)/libc_sec/include
    ifneq ($(findstring $(PRODUCT),  ascend910 ascend920 ascend920esl),)
        EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_CLOUD
        EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_CLOUD_HOST
    else ifeq ($(PRODUCT),ascend710)
        EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_ESL_FPGA
        EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_MDC_V51
    else
        EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_MINIV1
    endif

endif

ccflags-y += -Wall -Werror

obj-m += drv_pcie_hdc_host.o

drv_pcie_hdc_host-objs := hdcdrv_core.o hdcdrv_core_com.o hdcdrv_host.o hdcdrv_mem.o hdcdrv_mem_com.o hdcdrv_epoll.o hdcdrv_sysfs.o

endif
